import { defineStore } from 'pinia'
import { ref } from 'vue'

// 登录用户名
export const usernameStore = defineStore('username', () => {
  const username = ref('')
  function saveUserName(name) {
    username.value = name
  }
  return { username, saveUserName }
})

// 购物车数量
export const cartCountStore = defineStore('cartCount', () => {
  const cartCount = ref(0)
  function saveCartCount(count) {
    cartCount.value = count
  }
  return { cartCount, saveCartCount }
})